package com.cn.busi;

import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.cn.model.Car;
import com.cn.model.CarDetail;
import com.cn.model.User;
import com.cn.service.CarSerivce;
import com.cn.service.UserService;


@RestController
@RequestMapping(value = "/api/v2")

public class CarsController {

	@Autowired
	private CarSerivce carService;

	private Logger logger = LoggerFactory.getLogger(CarsController.class);
	
	
	/**
	 * 查询车辆
	 * @param id
	 */
	@RequestMapping(value = "/cars/{id}", method = RequestMethod.GET)
	public void getcar(@PathVariable("id") String id) {
		carService.queryCar(id);
	}
	
	/**
	 * 插入车辆信息
	 * @param car
	 */
	@RequestMapping(value = "/addcar", method = RequestMethod.POST)
	public void addcar(@RequestBody CarDetail car) {
		carService.addCar(car);
		logger.info("addcar：" + "插入成功");

	}

	@RequestMapping(value = "/updata/{id}", method = RequestMethod.PUT)
	public void updatacar(@PathVariable("id") String id,@RequestBody CarDetail car) {
		logger.info("updatacar：" + "更新成功");
	}

	@RequestMapping(value = "/delete/{id}", method = RequestMethod.DELETE)
	public void deletecar(@PathVariable("id") String id) {
		logger.info("deletecar:" +"删除成功");

	}

}
